home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / marionettemadness.swf / scripts / __Packages / com / mosesSupposes / fuse / Shortcuts.as < prev    next >
Text File  |  2007-10-01  |  15KB  |  396 lines

  1. class com.mosesSupposes.fuse.Shortcuts
  2. {
  3.    static var registryKey = "shortcuts";
  4.    static var shortcuts = null;
  5.    static var mcshortcuts = null;
  6.    function Shortcuts()
  7.    {
  8.    }
  9.    static function initialize()
  10.    {
  11.       if(com.mosesSupposes.fuse.Shortcuts.shortcuts == null)
  12.       {
  13.          com.mosesSupposes.fuse.Shortcuts.initShortcuts();
  14.       }
  15.    }
  16.    static function doShortcut(obj, methodName)
  17.    {
  18.       com.mosesSupposes.fuse.Shortcuts.initialize();
  19.       var _loc5_ = com.mosesSupposes.fuse.Shortcuts.shortcuts[methodName];
  20.       if(_loc5_ == undefined)
  21.       {
  22.          if(typeof obj == "movieclip")
  23.          {
  24.             _loc5_ = com.mosesSupposes.fuse.Shortcuts.mcshortcuts[methodName];
  25.          }
  26.       }
  27.       if(_loc5_ == undefined)
  28.       {
  29.          return null;
  30.       }
  31.       obj = arguments.shift();
  32.       methodName = String(arguments.shift());
  33.       if(!(obj instanceof Array))
  34.       {
  35.          obj = [obj];
  36.       }
  37.       var _loc3_ = "";
  38.       for(var _loc6_ in obj)
  39.       {
  40.          var _loc2_ = String(_loc5_.apply(obj[_loc6_],arguments));
  41.          if(_loc2_ != null && _loc2_.length > 0)
  42.          {
  43.             if(_loc3_.length > 0)
  44.             {
  45.                _loc3_ = _loc2_ + "|" + _loc3_;
  46.             }
  47.             else
  48.             {
  49.                _loc3_ = _loc2_;
  50.             }
  51.          }
  52.       }
  53.       return _loc3_ != "" ? _loc3_ : null;
  54.    }
  55.    static function addShortcutsTo()
  56.    {
  57.       com.mosesSupposes.fuse.Shortcuts.initialize();
  58.       var _loc5_ = function(o, so)
  59.       {
  60.          for(var _loc5_ in so)
  61.          {
  62.             var _loc2_ = so[_loc5_];
  63.             if(_loc2_.getter || _loc2_.setter)
  64.             {
  65.                o.addProperty(_loc5_,_loc2_.getter,_loc2_.setter);
  66.                _global.ASSetPropFlags(o,_loc5_,3,1);
  67.             }
  68.             else
  69.             {
  70.                o[_loc5_] = _loc2_;
  71.                _global.ASSetPropFlags(o,_loc5_,7,1);
  72.             }
  73.          }
  74.       };
  75.       for(var _loc7_ in arguments)
  76.       {
  77.          var _loc4_ = arguments[_loc7_];
  78.          if(_loc4_ == MovieClip.prototype || typeof _loc4_ == "movieclip")
  79.          {
  80.             _loc5_(_loc4_,com.mosesSupposes.fuse.Shortcuts.mcshortcuts);
  81.          }
  82.          _loc5_(_loc4_,com.mosesSupposes.fuse.Shortcuts.shortcuts);
  83.       }
  84.    }
  85.    static function removeShortcutsFrom()
  86.    {
  87.       com.mosesSupposes.fuse.Shortcuts.initialize();
  88.       var _loc5_ = function(o, so)
  89.       {
  90.          for(var _loc5_ in so)
  91.          {
  92.             _global.ASSetPropFlags(o,_loc5_,0,2);
  93.             var _loc2_ = so[_loc5_];
  94.             if(_loc2_.getter || _loc2_.setter)
  95.             {
  96.                o.addProperty(_loc5_,null,null);
  97.             }
  98.             delete o[_loc5_];
  99.          }
  100.       };
  101.       for(var _loc7_ in arguments)
  102.       {
  103.          var _loc3_ = arguments[_loc7_];
  104.          if(_loc3_ == MovieClip.prototype || typeof _loc3_ == "movieclip")
  105.          {
  106.             _loc5_(_loc3_,com.mosesSupposes.fuse.Shortcuts.mcshortcuts);
  107.          }
  108.          _loc5_(_loc3_,com.mosesSupposes.fuse.Shortcuts.shortcuts);
  109.       }
  110.    }
  111.    static function parseStringTypeCallback(callbackStr)
  112.    {
  113.       var evaluate = function(val)
  114.       {
  115.          var first = val.charAt(0);
  116.          if(first == val.slice(-1) && (first == "\"" || first == "\'"))
  117.          {
  118.             return val.slice(1,-1);
  119.          }
  120.          if(val == "true")
  121.          {
  122.             return Object(true);
  123.          }
  124.          if(val == "false")
  125.          {
  126.             return Object(false);
  127.          }
  128.          if(val == "null")
  129.          {
  130.             return Object(null);
  131.          }
  132.          if(_global.isNaN(Number(val)) == false)
  133.          {
  134.             return Object(Number(val));
  135.          }
  136.          return Object(eval(val));
  137.       };
  138.       var trimWhite = function(str)
  139.       {
  140.          while(str.charAt(0) == " ")
  141.          {
  142.             str = str.slice(1);
  143.          }
  144.          while(str.slice(-1) == " ")
  145.          {
  146.             str = str.slice(0,-1);
  147.          }
  148.          return str;
  149.       };
  150.       var evaluateList = function(list)
  151.       {
  152.          var _loc11_ = [];
  153.          var _loc4_ = 0;
  154.          while(_loc4_ < list.length)
  155.          {
  156.             var _loc3_ = list[_loc4_];
  157.             _loc3_ = trimWhite(_loc3_);
  158.             var _loc5_ = _loc3_.charAt(0) == "{" && (_loc3_.indexOf("}") > -1 || _loc3_.indexOf(":") > -1);
  159.             var _loc10_ = _loc3_.charAt(0) == "[";
  160.             if((_loc5_ || _loc10_) == true)
  161.             {
  162.                var _loc6_ = _loc5_ != true ? [] : {};
  163.                var _loc2_ = _loc4_;
  164.                while(_loc2_ < list.length)
  165.                {
  166.                   if(_loc2_ == _loc4_)
  167.                   {
  168.                      _loc3_ = _loc3_.slice(1);
  169.                   }
  170.                   var _loc1_ = undefined;
  171.                   var _loc8_ = _loc1_.slice(-1) == (_loc5_ != true ? "]" : "}") || _loc2_ == list.length - 1;
  172.                   if(_loc8_ == true)
  173.                   {
  174.                      _loc1_ = _loc1_.slice(0,-1);
  175.                   }
  176.                   if(_loc5_ == true && _loc1_.indexOf(":") > -1)
  177.                   {
  178.                      var _loc7_ = _loc1_.split(":");
  179.                      _loc6_[trimWhite(_loc7_[0])] = evaluate(trimWhite(_loc7_[1]));
  180.                   }
  181.                   else if(_loc10_ == true)
  182.                   {
  183.                      _loc6_.push(evaluate(trimWhite(_loc1_)));
  184.                   }
  185.                   if(_loc8_ == true)
  186.                   {
  187.                      _loc11_.push(_loc6_);
  188.                      _loc4_ = _loc2_;
  189.                      break;
  190.                   }
  191.                   _loc2_ = _loc2_ + 1;
  192.                }
  193.             }
  194.             else
  195.             {
  196.                _loc11_.push(evaluate(trimWhite(_loc3_)));
  197.             }
  198.             _loc4_ = _loc4_ + 1;
  199.          }
  200.          return _loc11_;
  201.       };
  202.       var parts = callbackStr.split("(");
  203.       var p0 = parts[0];
  204.       var p1 = parts[1];
  205.       return {func:p0.slice(p0.lastIndexOf(".") + 1),scope:eval(p0.slice(0,p0.lastIndexOf("."))),args:evaluateList(p1.slice(0,p1.lastIndexOf(")")).split(","))};
  206.    }
  207.    static function initShortcuts()
  208.    {
  209.       com.mosesSupposes.fuse.Shortcuts.shortcuts = new Object();
  210.       var methods = {alphaTo:"_alpha",scaleTo:"_scale",sizeTo:"_size",rotateTo:"_rotation",brightnessTo:"_brightness",brightOffsetTo:"_brightOffset",contrastTo:"_contrast",colorTo:"_tint",tintPercentTo:"_tintPercent",colorResetTo:"_colorReset",invertColorTo:"_invertColor"};
  211.       var _loc4_ = _global.com.mosesSupposes.fuse.FuseFMP.getAllShortcuts();
  212.       var _loc7_ = {blur:1,blurX:1,blurY:1,strength:1,shadowAlpha:1,highlightAlpha:1,angle:1,distance:1,alpha:1,color:1};
  213.       for(var _loc9_ in _loc4_)
  214.       {
  215.          if(_loc7_[_loc4_[_loc9_].split("_")[1]] === 1)
  216.          {
  217.             methods[_loc4_[_loc9_] + "To"] = _loc4_[_loc9_];
  218.          }
  219.       }
  220.       var _loc8_ = {__resolve:function(name)
  221.       {
  222.          var propName = methods[name];
  223.          return function()
  224.          {
  225.             var _loc4_ = _global.com.mosesSupposes.fuse.ZigoEngine.doTween.apply(com.mosesSupposes.fuse.ZigoEngine,new Array(this,propName).concat(arguments));
  226.             return _loc4_;
  227.          };
  228.       }};
  229.       var _loc5_ = {__resolve:function(name)
  230.       {
  231.          var _loc3_ = {setter:function(v)
  232.          {
  233.             _global.com.mosesSupposes.fuse.ZigoEngine.doTween(this,name != "_tintString" ? name : "_tint",v,0);
  234.          }};
  235.          switch(name)
  236.          {
  237.             case "_colorReset":
  238.                _loc3_.getter = function()
  239.                {
  240.                   return 100 - _global.com.mosesSupposes.fuse.ZigoEngine.getColorKeysObj(this).tintPercent;
  241.                };
  242.                break;
  243.             case "_colorTransform":
  244.                _loc3_.getter = function()
  245.                {
  246.                   return Color(new Color(this)).getTransform();
  247.                };
  248.                break;
  249.             case "_fade":
  250.                _loc3_.getter = function()
  251.                {
  252.                   return this._alpha;
  253.                };
  254.                break;
  255.             case "_size":
  256.                _loc3_.getter = function()
  257.                {
  258.                   return this._width != this._height ? null : this._width;
  259.                };
  260.                break;
  261.             case "_scale":
  262.                _loc3_.getter = function()
  263.                {
  264.                   return this._xscale != this._yscale ? null : this._xscale;
  265.                };
  266.                break;
  267.             default:
  268.                _loc3_.getter = function()
  269.                {
  270.                   return _global.com.mosesSupposes.fuse.ZigoEngine.getColorKeysObj(this)[name.slice(1)];
  271.                };
  272.          }
  273.          return _loc3_;
  274.       }};
  275.       for(_loc9_ in methods)
  276.       {
  277.          com.mosesSupposes.fuse.Shortcuts.shortcuts[_loc9_] = _loc8_[_loc9_];
  278.          if(_loc9_ != "alphaTo" && _loc9_ != "rotateTo")
  279.          {
  280.             com.mosesSupposes.fuse.Shortcuts.shortcuts[methods[_loc9_]] = _loc5_[methods[_loc9_]];
  281.          }
  282.       }
  283.       com.mosesSupposes.fuse.Shortcuts.shortcuts._tintString = _loc5_._tintString;
  284.       com.mosesSupposes.fuse.Shortcuts.shortcuts._colorTransform = _loc5_._colorTransform;
  285.       com.mosesSupposes.fuse.Shortcuts.shortcuts._fade = _loc5_._fade;
  286.       com.mosesSupposes.fuse.Shortcuts.shortcuts.tween = function(props, endVals, seconds, ease, delay, callback)
  287.       {
  288.          if(arguments.length == 1 && typeof props == "object")
  289.          {
  290.             return com.mosesSupposes.fuse.ZigoEngine.doTween({target:this,action:props});
  291.          }
  292.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,props,endVals,seconds,ease,delay,callback);
  293.       };
  294.       com.mosesSupposes.fuse.Shortcuts.shortcuts.removeTween = com.mosesSupposes.fuse.Shortcuts.shortcuts.stopTween = function(props)
  295.       {
  296.          com.mosesSupposes.fuse.ZigoEngine.removeTween(this,props);
  297.       };
  298.       com.mosesSupposes.fuse.Shortcuts.shortcuts.removeAllTweens = com.mosesSupposes.fuse.Shortcuts.shortcuts.stopAllTweens = function()
  299.       {
  300.          com.mosesSupposes.fuse.ZigoEngine.removeTween("ALL");
  301.       };
  302.       com.mosesSupposes.fuse.Shortcuts.shortcuts.isTweening = function(prop)
  303.       {
  304.          return com.mosesSupposes.fuse.ZigoEngine.isTweening(this,prop);
  305.       };
  306.       com.mosesSupposes.fuse.Shortcuts.shortcuts.getTweens = function()
  307.       {
  308.          return com.mosesSupposes.fuse.ZigoEngine.getTweens(this);
  309.       };
  310.       com.mosesSupposes.fuse.Shortcuts.shortcuts.lockTween = function()
  311.       {
  312.          com.mosesSupposes.fuse.ZigoEngine.lockTween(this,true);
  313.       };
  314.       com.mosesSupposes.fuse.Shortcuts.shortcuts.unlockTween = function()
  315.       {
  316.          com.mosesSupposes.fuse.ZigoEngine.lockTween(this,false);
  317.       };
  318.       com.mosesSupposes.fuse.Shortcuts.shortcuts.isTweenLocked = function()
  319.       {
  320.          return com.mosesSupposes.fuse.ZigoEngine.isTweenLocked(this);
  321.       };
  322.       com.mosesSupposes.fuse.Shortcuts.shortcuts.isTweenPaused = function(prop)
  323.       {
  324.          return com.mosesSupposes.fuse.ZigoEngine.isTweenPaused(this,prop);
  325.       };
  326.       com.mosesSupposes.fuse.Shortcuts.shortcuts.pauseTween = function(props)
  327.       {
  328.          com.mosesSupposes.fuse.ZigoEngine.pauseTween(this,props);
  329.       };
  330.       com.mosesSupposes.fuse.Shortcuts.shortcuts.resumeTween = com.mosesSupposes.fuse.Shortcuts.shortcuts.unpauseTween = function(props)
  331.       {
  332.          com.mosesSupposes.fuse.ZigoEngine.unpauseTween(this,props);
  333.       };
  334.       com.mosesSupposes.fuse.Shortcuts.shortcuts.pauseAllTweens = function()
  335.       {
  336.          com.mosesSupposes.fuse.ZigoEngine.pauseTween("ALL");
  337.       };
  338.       com.mosesSupposes.fuse.Shortcuts.shortcuts.resumeAllTweens = com.mosesSupposes.fuse.Shortcuts.shortcuts.unpauseAllTweens = function()
  339.       {
  340.          com.mosesSupposes.fuse.ZigoEngine.unpauseTween("ALL");
  341.       };
  342.       com.mosesSupposes.fuse.Shortcuts.shortcuts.ffTween = function(props)
  343.       {
  344.          com.mosesSupposes.fuse.ZigoEngine.ffTween(this,props);
  345.       };
  346.       com.mosesSupposes.fuse.Shortcuts.shortcuts.rewTween = function(props, suppressStartEvents)
  347.       {
  348.          com.mosesSupposes.fuse.ZigoEngine.rewTween(this,props,false,suppressStartEvents);
  349.       };
  350.       com.mosesSupposes.fuse.Shortcuts.shortcuts.rewAndPauseTween = function(props, suppressStartEvents)
  351.       {
  352.          com.mosesSupposes.fuse.ZigoEngine.rewTween(this,props,true,suppressStartEvents);
  353.       };
  354.       com.mosesSupposes.fuse.Shortcuts.shortcuts.skipTweenTo = function(seconds, props)
  355.       {
  356.          com.mosesSupposes.fuse.ZigoEngine.skipTweenTo(seconds,this,props);
  357.       };
  358.       com.mosesSupposes.fuse.Shortcuts.shortcuts.bezierTo = function(destX, destY, controlX, controlY, seconds, ease, delay, callback)
  359.       {
  360.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_bezier_",{x:destX,y:destY,controlX:controlX,controlY:controlY},seconds,ease,delay,callback);
  361.       };
  362.       com.mosesSupposes.fuse.Shortcuts.shortcuts.colorTransformTo = function(ra, rb, ga, gb, ba, bb, aa, ab, seconds, ease, delay, callback)
  363.       {
  364.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_colorTransform",{ra:ra,rb:rb,ga:ga,gb:gb,ba:ba,bb:bb,aa:aa,ab:ab},seconds,ease,delay,callback);
  365.       };
  366.       com.mosesSupposes.fuse.Shortcuts.shortcuts.tintTo = function(rgb, percent, seconds, ease, delay, callback)
  367.       {
  368.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_tint",{tint:rgb,percent:percent},seconds,ease,delay,callback);
  369.       };
  370.       com.mosesSupposes.fuse.Shortcuts.shortcuts.slideTo = function(destX, destY, seconds, ease, delay, callback)
  371.       {
  372.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_x,_y",[destX,destY],seconds,ease,delay,callback);
  373.       };
  374.       com.mosesSupposes.fuse.Shortcuts.shortcuts.fadeIn = function(seconds, ease, delay, callback)
  375.       {
  376.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_fade",100,seconds,ease,delay,callback);
  377.       };
  378.       com.mosesSupposes.fuse.Shortcuts.shortcuts.fadeOut = function(seconds, ease, delay, callback)
  379.       {
  380.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_fade",0,seconds,ease,delay,callback);
  381.       };
  382.       com.mosesSupposes.fuse.Shortcuts.mcshortcuts = new Object();
  383.       com.mosesSupposes.fuse.Shortcuts.mcshortcuts._frame = {getter:function()
  384.       {
  385.          return this._currentframe;
  386.       },setter:function(v)
  387.       {
  388.          this.gotoAndStop(Math.round(v));
  389.       }};
  390.       com.mosesSupposes.fuse.Shortcuts.mcshortcuts.frameTo = function(endframe, seconds, ease, delay, callback)
  391.       {
  392.          return com.mosesSupposes.fuse.ZigoEngine.doTween(this,"_frame",endframe == undefined ? this._totalframes : endframe,seconds,ease,delay,callback);
  393.       };
  394.    }
  395. }
  396.